package com.example.administrator.yuejian23.Activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.example.administrator.yuejian23.Fragment.AllOrderFragment;
import com.example.administrator.yuejian23.Fragment.ClubCourseFragment;
import com.example.administrator.yuejian23.Fragment.ClubIntroFragment;
import com.example.administrator.yuejian23.Fragment.ClubVideoFragment;
import com.example.administrator.yuejian23.Fragment.NosucceedOrderFragment;
import com.example.administrator.yuejian23.Fragment.SucceedOrderFragment;
import com.example.administrator.yuejian23.R;
import com.squareup.picasso.Picasso;

/**
 * Created by Administrator on 2017/11/9.
 */

public class OrderActivity extends BaseActivity  {
    private ImageView imageView;
    private RadioGroup radioGroup;
    private AllOrderFragment allOrderFragment;
    private SucceedOrderFragment succeedOrderFragment;
    private NosucceedOrderFragment nosucceedOrderFragment;
    private FragmentManager manager;
    private FragmentTransaction transaction;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_order);

        radioGroup= (RadioGroup)findViewById(R.id.radioGroup);
        //
        manager=getSupportFragmentManager();
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {

                switch (checkedId){

                    case R.id.radio_AllOrder:
                        allOrderFragment=new AllOrderFragment();
                        replace(allOrderFragment);
                        break;
                    case R.id.radio_SucceedOrder:
                        succeedOrderFragment=new SucceedOrderFragment();
                        replace(succeedOrderFragment);
                        break;
                    case R.id.radio_ExitOrder:
                        nosucceedOrderFragment=new NosucceedOrderFragment();
                        replace(nosucceedOrderFragment);
                        break;
                }
            }
        });

        radioGroup.check(R.id.radio_AllOrder);

    }

    private void replace(Fragment fragment){
        transaction=manager.beginTransaction();
        transaction.replace(R.id.user_order_recyclerview,fragment);
        transaction.commit();
    }
}
